package com.wang.learn.common.exception;

import com.wang.learn.common.model.BaseResult;
import lombok.Getter;
import lombok.ToString;

/**
 * 类描述：业务异常
 *
 * @author Charles
 * @time 2021/10/9 10:39
 */
@ToString
@Getter
public class BizException extends RuntimeException implements IBaseException {

    private static final long serialVersionUID = 1L;
    String code;
    String msg;

    public BizException(String code,String msg) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }

    @Override
    public BaseResult toResult() {
        return new BaseResult(this.code,this.msg,null);
    }


    @Override
    public synchronized Throwable fillInStackTrace() {
        return this;
    }

}
